
interface Person {
  name: string;
  age?: number; // 可选属性
  readonly sex: string; //只读属性
  [key: string|number]: any; // 任意属性
}

const person: Person = {
    name: "张三",
    age: 18,
    sex: "男",
    height: 1.88,
    isMarried: true,
    1: '111'
};
// 索引类型
type NameType = Person['name']

// person.sex='女' // 报错 只读属性



export {}